import { DAKALIST,SDAKALIST } from './actionTypes'
import { post } from '@u/http'

const loadSync =list=>{
    return{
        type: DAKALIST,
        list
    }
} 
const loadSyncs =lists=>{
    return{
        type: SDAKALIST,
        lists
    }
} 

const loadAsync = (data)=>{
    return async dispatch=>{
        let result = await post({
            url:'api/daka/list'
        },{
          data:data
        })
        // console.log(result.dkDakaList)
        dispatch( loadSync(result.dkDakaList ))
    }
}
const loadAsyncs = (data)=>{
    return async dispatch=>{
        let result = await post({
            url:'api/daka/menu'
        },{
          data:data
        })
        console.log(result)
        dispatch( loadSyncs(result.dkDakaList ))
    }
}

export {
    loadSync,
    loadAsync,
    loadAsyncs,
    loadSyncs
}